package com.wang.test.demo.entity;


import com.wang.test.demo.exception.AddGroup;
import com.wang.test.demo.exception.EditGroup;
import com.wang.test.demo.exception.ListValue;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;

@Data
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotNull(message = "修改必须有品牌id",groups = {EditGroup.class})
	@Null(message = "新增不能指定id",groups = {AddGroup.class})
	private Long brandId;
	/**
	 * 品牌名F
	 */
	@NotBlank(message = "品牌名必须提交")
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(message = "地址必须不为空")
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;

	/**
	 * 检索首字母
	 */
	//自定义校验规则
	@Pattern(regexp = "^[a-zA-Z]$",message = "检索的首字母必须是字母")
	private String firstLetter;
	/**
	 * 排序
	 */
	@Min(value = 0,message = "排序必须大于等于0")
	private Integer sort;

	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(groups = {AddGroup.class, EditGroup.class})
	// @ListValue(vals = {0,1},groups = {AddGroup.class, EditGroup.class},message = "必须为0或者1")
	private Integer showStatus;

}
